python gambling machine

31

import play
import random 

play.screen.width = 800
play.screen.height = 610

#_______________
play.new_box(color='yellow', x=-119, y=0, width=100, height=200, border_color='black', border_width=5, angle=0, transparency=100, size=100)
play.new_box(color='yellow', x=10, y=0, width=100, height=200, border_color='black', border_width=5, angle=0, transparency=100, size=100)
play.new_box(color='yellow', x=147, y=0, width=100, height=200, border_color='black', border_width=5, angle=0, transparency=100, size=100)
#______________
#páka
play.new_box(color='black', x=300, y=0, width=50, height=167, border_color='black', border_width=5, angle=0, transparency=100, size=100)
paka = play.new_circle(color='red', x=300, y=61, radius=100, border_color='black', border_width=1, transparency=100, size=37, angle=0)
#_______________

pole1 = play.new_text(words='', x=12, y=0, font=None, font_size=50, color='black', angle=0, transparency=100, size=200)
pole2 = play.new_text(words='', x=-117, y=0, font=None, font_size=50, color='black', angle=0, transparency=100, size=200)
pole3 = play.new_text(words='', x=148, y=0, font=None, font_size=50, color='black', angle=0, transparency=100, size=200)
#_______________
play.new_text(words='Výherní Automat', x=10, y=250, font=None, font_size=50, color='blue', angle=0, transparency=100, size=100)
#____________
vyhra = play.new_text(words='', x=10, y=-160, font=None, font_size=50, color='green', angle=0, transparency=100, size=100)

def generator () :
    pole1.words = random.randint (0, 9)
    pole2.words = random.randint (0, 9)
    pole3.words = random.randint (0, 9)
    if pole1.words == pole2.words and pole1.words== pole3.words :
        vyhra.words = "Vyhrál jsi!"
    else :
        vyhra.words = "Prohrál jsi!"
        


@play.repeat_forever
def pakaY () :
    if paka.is_clicked :
        generator ()
        if paka.y == 61 :
            paka.y = -60
        else:
            paka.y = 61
                


play.start_program()

Comments

Submit
0 Comments